package com.example.juc;

public class AccountTest implements Runnable{
    private Integer money=1000;
    @Override
    public void run() {
            synchronized (this){
                money-=100;
                System.out.println("剩余"+money);
            }
    }

    public static void main(String[] args) {
        AccountTest accountTest = new AccountTest();
        new Thread(accountTest,"A").start();
        new Thread(accountTest,"B").start();
        new Thread(accountTest,"C").start();
        new Thread(accountTest,"D").start();
        new Thread(accountTest,"E").start();
        new Thread(accountTest,"F").start();
        new Thread(accountTest,"G").start();
    }
}
